from GomokuTestBase import GomokuTestBase
import time

class ChatTest(GomokuTestBase):
    def run(self):
        """Run the chat test."""
        # Login both players
        self.login(self.firefox_driver, self.PLAYER1_CREDENTIALS)
        self.login(self.edge_driver, self.PLAYER2_CREDENTIALS)

        # Start match
        self.start_match()

        # Test chat from Edge to Firefox
        test_str1 = "this is a test data! from EdgeDriver"
        self.send_chat_message(self.edge_driver, test_str1)
        if self.verify_chat_message(self.firefox_driver, test_str1):
            print("Edge to Firefox chat successful")

        time.sleep(3)

        # Test chat from Firefox to Edge
        test_str2 = "this is a test data! from FireFoxEdgeDriver"
        self.send_chat_message(self.firefox_driver, test_str2)
        if self.verify_chat_message(self.edge_driver, test_str2):
            print("Firefox to Edge chat successful")

        self.cleanup()

if __name__ == "__main__":
    test = ChatTest()
    test.run()